var app = new Vue({
    el: "#app",
    data: {
        entity: {}
    },
    methods: {
        findOne: function () {
            var id = this.getParameterByName("id");
            if (id == null) {
                window.location.href = "index.html";
            }
            axios.get("../article/findOne/" + id + ".do").then(function (response) {
                app.entity = response.data;
            });
        },

        //根据参数名字获取参数
        getParameterByName: function (name) {
            return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[1].replace(/\+/g, '%20')) || null
        },
        //格式化日期
        formatDate:function (time) {
            var date = new Date(time);
            return date.toLocaleString();
        }
    },
    created: function () {
        this.findOne();
    }
});